<?php
include_once('../includes/utilidades.php');
require_once('../includes/seguridad.php');

session_start();
$rolesConAcceso = array('admin', 'organizador');
if (!rolOK($_SESSION['roles'], $rolesConAcceso))
    exit;

//print_r($_SESSION);
$temporadaid = $_SESSION['estado']['temporada'][0]['id'];
$competicionid=$_REQUEST['id'];
$temporada = select("select * from temporada", "id=" . $temporadaid);
$competicion =  select("select * from competicion", "id=" . $competicionid);
//print_r($competicion);
print "<h1>" . $temporada[0]['nombre'] ."</h1>";
print "<h2>" . $competicion[0]['nombre'] ."</h2>";

$actual = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];
actualizarEstado($_SESSION,$competicion,'competicion',$tablas);
//print ($actual);
 
 
 $_SESSION['afterAdd']['jornada'] = $actual;
 //$_SESSION['competicion']['id']=$competicionid;
 
 $valoresFK = array ('idcompeticion' => $competicionid );
 
 $filtro = " where idcompeticion=" . $competicionid;


if (!(isUserInRol($_SESSION['username'], "admin"))) {
    if ((isUserInRol($_SESSION['username'], "club"))) {
        $in = operatorRolIn("club_");
        $filtro .= " and idorganizador IN " . $in;
    }
} 
 
 
 //$sql = "select j.id as id, j.nombre, j.fecha, c.nombre as organizador from jornada j,club c where j.idorganizador=c.id " . $filtro;
 $sql = "select j.id as id, j.nombre, j.fecha, c.nombre as organizador from jornada j left join club c on j.idorganizador=c.id " . $filtro;
 
 print $sql;
 
 $jornada = select2($sql);
 toHTML('jornada',$jornada,'id');
 //HTMLadd("jornada",$valoresFK);
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

